package com.ag.hmk.service.impl;

import com.ag.bean.TbAidgoogs;
import com.ag.bean.TbAidgoogsId;
import com.ag.common.IDUtil;
import com.ag.hmk.dao.HmkAidGoodsDAO;
import com.ag.hmk.service.AidGoodsService;

/**
 * 
 * @author 黄木看
 * 仓库物品服务接口实现
 *
 */
public class AidGoodsServImpl implements AidGoodsService {

	private HmkAidGoodsDAO hmkAidGoodsDAO;
	
	/*
	 * 删除记录
	 */
	public void delete(TbAidgoogs tbAidgoogs) {
		if (tbAidgoogs!=null) {
			//tbAidgoogs.setA(IDUtil.DELETE);
			//hmkAidGoodsDAO.attachDirty(tbAidgoogs);
			hmkAidGoodsDAO.delete(tbAidgoogs);
		}
		
	}

	/*
	 * 查询一条记录（by id）
	 */
	public TbAidgoogs findByID(TbAidgoogsId tbagId) {
		if (tbagId!=null) {
			return hmkAidGoodsDAO.findById(tbagId);
		} else {
			return null;
		}
		
	}

	/*
	 * 新增或更新记录
	 */
	public void save(TbAidgoogs tbAidgoogs) {
		if (tbAidgoogs!=null) {
			tbAidgoogs.setA(IDUtil.PRESERVE);
			hmkAidGoodsDAO.attachDirty(tbAidgoogs);
		}
		
	}

	public void setHmkAidGoodsDAO(HmkAidGoodsDAO hmkAidGoodsDAO) {
		this.hmkAidGoodsDAO = hmkAidGoodsDAO;
	}

}
